$(document).ready(function() {
	$.fn.fullpage({
		afterLoad: function(anchorLink, index){
			if(index == 3){
				$('.section3').find('#write1').delay(500).animate({
					right: '-190'
				}, 1500, 'easeOutExpo');
			}
			if(index == 3){
				$('.section3').find('#write2').delay(500).animate({
					left: '-220'
				}, 1500, 'easeOutExpo');
			}
			if(index == 4){
				$('.section4').find('#letter').delay(200).animate({
					top: '-80'
				}, 1500, 'easeOutExpo')
				.animate({
					top: '-50'
				}, 1500, 'easeOutExpo');
				$('.section4').find('#letter-text').delay(200).animate({
					top: '-30'
					
				}, 1500, 'easeOutExpo')
				.animate({
					top: '-0'
				}, 1500, 'easeOutExpo');
				$('.section4').find('#star1').fadeIn(2000);
				$('.section4').find('#star2').fadeIn(2000);
			}
			if(index == 5){
				$('.section5').find('#person-cycle').fadeIn(500);
				$('.section5').find('#person-cycle').fadeOut(500);
				$('.section5').find('#person-cycle').fadeIn(500);
				$('.section5').find('#shine').fadeOut(2000);
				$('.section5').find('#shine').fadeIn(500);
			}
			if(index == 6){
				$('.section6').find('#item-cycle1').fadeIn(500);
				$('.section6').find('#item-cycle2').fadeIn(500);
				$('.section6').find('#item-cycle3').fadeIn(500);
				$('.section6').find('#item-cycle4').fadeIn(500);

				$('.section6').find('#item-cycle1').delay(0).animate({
					left:'410'
				}, 1500, 'easeOutExpo');
				$('.section6').find('#item-cycle2').delay(0).animate({
					left:'470'
				}, 1500, 'easeOutExpo');
				$('.section6').find('#item-cycle3').delay(0).animate({
					right:'10'
				}, 1500, 'easeOutExpo');
				$('.section6').find('#item-cycle4').delay(0).animate({
					right:'70'
				}, 1500, 'easeOutExpo');
				
				$('.section6').find('#fly').delay(500).animate({
					top: '-90'
				}, 1500, 'easeOutExpo');				
			}
		},
		onLeave: function(index, direction){
			if(index == 3){
				$('.section3').find('#write1').delay(1000).animate({
					right: '-800'
				}, 1500, 'easeOutExpo');
			}
			if(index == 3){
				$('.section3').find('#write2').delay(1000).animate({
					left: '-800'
				}, 1500, 'easeOutExpo');
			}
			if(index == '4'){
				$('.section4').find('#star1').fadeOut(1000);
				$('.section4').find('#star2').fadeOut(1000);
			}
			if(index == 6){
				$('.section6').find('#item-cycle1').fadeOut(500);
				$('.section6').find('#item-cycle2').fadeOut(500);
				$('.section6').find('#item-cycle3').fadeOut(500);
				$('.section6').find('#item-cycle4').fadeOut(500);

				$('.section6').find('#item-cycle1').delay(0).animate({
					left:'510'
				}, 1500, 'easeOutExpo');
				$('.section6').find('#item-cycle2').delay(0).animate({
					left:'570'
				}, 1500, 'easeOutExpo');
				$('.section6').find('#item-cycle3').delay(0).animate({
					right:'110'
				}, 1500, 'easeOutExpo');
				$('.section6').find('#item-cycle4').delay(0).animate({
					right:'170'
				}, 1500, 'easeOutExpo');
				
				$('.section6').find('#fly').delay(500).animate({
					top: '0'
				}, 1500, 'easeOutExpo');				
			}
		}
	});
});